﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Data.DataGet;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.ComponentModel;

namespace Business.DataBusiness
{
    public class HoaDonBan
    {
        _HoaDonBan data = new _HoaDonBan();    
        private string maHDB;
        private string tenKH;
        private string diaChi;
        private string maNV;
        private float thueXuat;
        private float tongTien;
        private float khuyenMai;
        private DateTime ngayBan;


        public string MaHDB
        {
            get { return maHDB; }
            set { maHDB = value; }
        }
       
        public string TenKH
        {
            get { return tenKH; }
            set { tenKH = value; }
        }
       
        public string DiaChi
        {
            get { return diaChi; }
            set { diaChi = value; }
        }
        
        public string MaNV
        {
            get { return maNV; }
            set 
            { 
                maNV = value;
                if (maNV == "")
                    throw new Exception("Mã nhân viên bán ?");
            }
        }
       
        public float ThueXuat
        {
            get { return thueXuat; }
            set { thueXuat = value; }
        }
        

        public float TongTien
        {
            get { return tongTien; }
            set
            {
                tongTien = value;
            }
        }
        

        public float KhuyenMai
        {
            get { return khuyenMai; }
            set { khuyenMai = value; }
        }
       

        public  DateTime NgayBan
        {
            get { return ngayBan; }
            set { ngayBan = value; }
        }

        public HoaDonBan() { }
        public HoaDonBan(string maHDB1, string tenKH1, string diaChi1, string maNV1, float thueXuat1, float tongTien1, float khuyenMai1, DateTime ngayBan1)
        {
            this.MaHDB = maHDB1;
            this.TenKH = tenKH1;
            this.DiaChi = diaChi1;
            this.MaNV = maNV1;
            this.ThueXuat = thueXuat1;
            this.TongTien = tongTien1;
            this.KhuyenMai = khuyenMai1;
            this.NgayBan = ngayBan1;
        }
        public int Insert()
        {
            return data.Insert_HoaDonBan(this.MaHDB,this.TenKH,this.DiaChi,this.MaNV,this.ThueXuat,this.TongTien,this.KhuyenMai,this.NgayBan);
        }

   
    }
}
